package net.liangyihui.dtbos.common.vo;

import net.liangyihui.dtbos.modules.entity.BosuserIdentity;
import org.springframework.core.NamedThreadLocal;

public class BosUserManager {

    static  ThreadLocal<BosuserIdentity> bosuserThreadLocal = new NamedThreadLocal<BosuserIdentity>("bosuseridentity 对象共享");

    public static Integer getUserId() {
        BosuserIdentity bosuserIdentity = bosuserThreadLocal.get();
        return bosuserIdentity.getUserId();
    }

    public static BosuserIdentity getBosUser() {
        BosuserIdentity bosuserIdentity = bosuserThreadLocal.get();
        return bosuserIdentity;
    }

    public static void setBosUser(BosuserIdentity bosuserIdentity) {
        bosuserThreadLocal.set(bosuserIdentity);
    }
}
